home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_352 / treewalk / rexx / daily.ftw < prev    next >
Text File  |  1992-05-06  |  2KB  |  54 lines

  1. /*
  2.  * daily backup treewalk routine - gets treewalk to check the exclusions
  3.  *    list, and then copies the files that need copying.
  4.  *
  5.  *    Copyright (C) 1989  Mike Meyer
  6.  *
  7.  *    This program is free software; you can redistribute it and/or modify
  8.  *    it under the terms of the GNU General Public License as published by
  9.  *    the Free Software Foundation; either version 1, or any later version.
  10.  *
  11.  *    This program is distributed in the hope that it will be useful,
  12.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *    GNU General Public License for more details.
  15.  *
  16.  *    You should have received a copy of the GNU General Public License
  17.  *    along with this program; if not, write to the Free Software
  18.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. mycom = getclip("daily.backup")
  22. '' mycom
  23. if rc ~= 0 then return 0
  24.  
  25. in = arg(1) || arg(2)
  26. out = 'daily:'overlay("/", in, index(in, ':'))
  27. return copy(in, out)
  28.  
  29. /*
  30.  * copy - makes sure the directory is in place for the destination,
  31.  *    then copies infile to outfile.
  32.  */
  33. copy: procedure
  34.     parse arg infile, outfile
  35.  
  36.     /* Is the directory there? */
  37.     outdex = lastpos('/', outfile)
  38.     do while outdex > 0
  39.         outdir = substr(outfile, 1, outdex - 1)
  40.         if exists(outdir) then break
  41.         outdex = lastpos('/', outfile, outdex - 1)
  42.         end
  43.     outdex = index(outfile, '/', outdex + 1)
  44.  
  45.     do while outdex > 0
  46.         outdir = substr(outfile, 1, outdex - 1)
  47.         address command 'makedir' outdir
  48.         outdex = index(outfile, '/', outdex + 1)
  49.         end
  50.  
  51.     address command 'copy' infile 'to' outfile
  52.     return rc ~= 0
  53.  
  54.